<template>
	<div class="ef-node-form" v-show="type !== 'line'">
		<el-tabs tab-position="top">
			<el-form :model="node" ref="dataForm" label-width="80px" v-show="type === 'node'">
				<el-tab-pane label="基本属性">
					<el-form-item label="排序号">
						<el-input-number v-model="node.sortNo" placeholder="排序号"></el-input-number>
					</el-form-item>
					<el-form-item label="类型">
						<el-input v-model="node.type" :disabled="true"></el-input>
					</el-form-item>
					<el-form-item label="步骤名称">
						<el-input v-model="node.name" maxlength="20" placeholder="步骤名称"></el-input>
					</el-form-item>
					<el-form-item label="行政级别">
						<el-select v-model="node.userLevel" style="width: 100%" placeholder="行政职务">
							<el-option v-for="item in userLevelList" :key="item.value" :label="item.label" :value="item.value"/>
						</el-select>
						<div class="el-form-item-msg">当流程开启行政级别审批时，将做为下一步骤的检索条件。</div>
					</el-form-item>
					<el-form-item label="步骤说明">
						<el-input v-model="node.remark" maxlength="20"></el-input>
					</el-form-item>
					<el-form-item label="位置坐标">
						<span>x:{{ node.left }}</span><span style="margin-left: 20px">y:{{ node.top }}</span>
					</el-form-item>
					<el-form-item label="ico图标">
						<el-input v-model="node.ico"></el-input>
					</el-form-item>
					<el-form-item label="状态">
						<el-radio-group v-model="node.state">
							<el-radio-button label="1">启用</el-radio-button>
							<el-radio-button label="0">停用</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="标题修改">
						<el-radio-group v-model="node.changeTitle">
							<el-radio-button label="1">允许</el-radio-button>
							<el-radio-button label="0">禁止</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="关注禁用">
						<el-radio-group v-model="node.follow">
							<el-radio-button label="1">允许</el-radio-button>
							<el-radio-button label="0">禁止</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="加签方式">
						<el-radio-group v-model="node.addStep">
							<el-radio-button label="0">禁止</el-radio-button>
							<el-radio-button label="1">前签</el-radio-button>
							<el-radio-button label="2">后签</el-radio-button>
							<el-radio-button label="3">任意</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="会签禁用">
						<el-radio-group v-model="node.approvalFlag">
							<el-radio-button label="0">禁止</el-radio-button>
							<el-radio-button label="1">允许</el-radio-button>
							<el-radio-button label="2">强制</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="显示会签">
						<el-radio-group v-model="node.approval">
							<el-radio-button label="0">隐藏</el-radio-button>
							<el-radio-button label="1">显示</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="中途结束">
						<el-radio-group v-model="node.passEndFlag">
							<el-radio-button label="0">继续</el-radio-button>
							<el-radio-button label="1">结束</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="是否等待">
						<el-radio-group v-model="node.parentWait">
							<el-radio-button label="0">正常</el-radio-button>
							<el-radio-button label="1">指定</el-radio-button>
							<el-radio-button label="2">强制</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="等待步骤" v-if="node.parentWait=='1'">
						<el-select v-model="node.waitStepId">
							<el-option v-for="item in waitStepList" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="提交规则">
						<el-radio-group v-model="node.doRule">
							<el-radio-button label="0">正常执行</el-radio-button>
							<el-radio-button label="1">主办先办</el-radio-button>
							<el-radio-button label="2">经办先办</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="回退设置">
						<el-radio-group v-model="node.goBack">
							<el-radio-button label="0">禁止</el-radio-button>
							<el-radio-button label="1">上一步</el-radio-button>
							<el-radio-button label="2">任意</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="跳跃审批">
						<el-radio-group v-model="node.sameJump">
							<el-radio-button label="0">禁止</el-radio-button>
							<el-radio-button label="1">开启</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="是否并发">
						<el-radio-group v-model="node.concurrentFlag">
							<el-radio-button label="0">禁止</el-radio-button>
							<el-radio-button label="1">允许</el-radio-button>
							<el-radio-button label="2">强制</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="是否并发">
						<el-radio-group v-model="node.gatherFlag">
							<el-radio-button label="0">随意</el-radio-button>
							<el-radio-button label="1">合并</el-radio-button>
							<el-radio-button label="2">强制</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="随意抄送">
						<el-radio-group v-model="node.sendToRole">
							<el-radio-button label="0">禁止</el-radio-button>
							<el-radio-button label="1">允许</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="超时时限">
						<el-input-number v-model="node.passTime" placeholder="超时时限" :min="0" :max="100"></el-input-number>
						小时
					</el-form-item>
				</el-tab-pane>
				<el-tab-pane label="经办权限">
					<el-form-item label="审批人员">
						<select-user-dialog v-model:accountId="node.userRole" :temp-org-id="tempOrgId" :mode="true"/>
					</el-form-item>
					<el-form-item label="审批部门">
						<select-dept-dialog v-model:deptId="node.deptRole" :temp-org-id="tempOrgId" :mode="true"/>
					</el-form-item>
					<el-form-item label="行政职务">
						<select-user-level-dialog v-model:levelId="node.levelRole" :temp-org-id="tempOrgId" :mode="true"/>
					</el-form-item>
					<el-form-item label="禁用选人">
						<el-radio-group v-model="node.changeUser">
							<el-radio-button label="1">允许</el-radio-button>
							<el-radio-button label="0">禁止</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="主办设置">
						<el-radio-group v-model="node.opRule">
							<el-radio-button label="0">指定</el-radio-button>
							<el-radio-button label="1">先接收</el-radio-button>
							<el-radio-button label="2">后接收</el-radio-button>
							<el-radio-button label="3">无主办</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="筛选规则" v-if="node.opRule=='0'">
						<el-select v-model="node.autoUserModel" @change="initModel">
							<el-option v-for="item in autoUserModelOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="主办人员" v-if="node.opRule=='0'&&node.autoUserModel=='1'">
						<select-user-dialog v-model:accountId="node.defaultAuto" :temp-org-id="tempOrgId" :mode="false"/>
					</el-form-item>
					<el-form-item label="经办人员" v-if="node.opRule!='0'||(node.opRule=='0' && node.autoUserModel=='1')">
						<select-user-dialog v-model:accountId="node.defaultAutoOther" :temp-org-id="tempOrgId" :mode="true"/>
					</el-form-item>
					<el-form-item label="指定部门" v-if="node.opRule=='0' && (node.autoUserModel=='4'||node.autoUserModel=='11')">
						<select-dept-dialog v-model:deptId="node.defaultAuto" :mode="false"/>
					</el-form-item>
					<el-form-item label="表单字段" v-if="node.opRule=='0' && node.autoUserModel=='7'">
						<el-select v-model="node.defaultAuto">
							<el-option v-for="item in formFieldList" :key="item.id" :value="item.id" :label="item.label"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="指定步骤" v-if="node.opRule=='0' && (node.autoUserModel=='6' || node.autoUserModel=='12' || node.autoUserModel=='14')">
						<el-select v-model="node.defaultAuto">
							<el-option v-for="item in bpmStepList" :key="item.value" :value="item.value" :label="item.label"></el-option>
						</el-select>
					</el-form-item>
				</el-tab-pane>
				<el-tab-pane label="数据权限">
					<el-form-item label="公共附件">
						<el-radio-group v-model="node.publicFileRole">
							<el-radio-button label="0">禁用</el-radio-button>
							<el-radio-button label="1">查看</el-radio-button>
							<el-radio-button label="2">下载</el-radio-button>
							<el-radio-button label="3">打印</el-radio-button>
							<el-radio-button label="4">编辑</el-radio-button>
							<el-radio-button label="5">套红</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="流程关联">
						<el-radio-group v-model="node.bpmLinkFlag">
							<el-radio-button label="0">禁用</el-radio-button>
							<el-radio-button label="1">可见</el-radio-button>
							<el-radio-button label="2">编辑</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="表单附件">
						<el-radio-group v-model="node.xUploadRole">
							<el-radio-button label="0">禁用</el-radio-button>
							<el-radio-button label="1">查看</el-radio-button>
							<el-radio-button label="2">下载</el-radio-button>
							<el-radio-button label="3">打印</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-collapse style="width: 100%" v-model="activeName">
						<el-collapse-item title="&nbsp;&nbsp;&nbsp;&nbsp;可写字段" name="1">
							<el-checkbox-group v-model="node.writerField" style="padding: 0px 20px 0px 20px">
								<template v-for="item in formFieldList" :key="item.id">
									<el-checkbox :label="item.id" v-if="item.elType!='children-data-table' && item.elType!='data-table'">{{ item.label }}</el-checkbox>
								</template>
							</el-checkbox-group>
						</el-collapse-item>
					</el-collapse>
					<el-collapse style="width: 100%">
						<el-collapse-item title="&nbsp;&nbsp;&nbsp;&nbsp;隐藏字段">
							<el-checkbox-group v-model="node.hideField" style="padding: 0 20px 0 20px">
								<template v-for="item in formFieldList" :key="item.id">
									<el-checkbox :label="item.id" v-if="item.elType!=='data-fill'">{{ item.label }}</el-checkbox>
								</template>
							</el-checkbox-group>
						</el-collapse-item>
					</el-collapse>
					<el-collapse style="width: 100%">
						<el-collapse-item title="&nbsp;&nbsp;&nbsp;&nbsp;列表权限">
							<scTable ref="table" :data="childTableList" row-key="id" stripe :hidePagination="true" :hideSetting="true" :hideRefresh="true">
								<el-table-column label="名称" prop="label" width="80"></el-table-column>
								<el-table-column label="添加行" prop="name" width="60">
									<template #default="scope">
										<el-checkbox v-model="childTableRowRole[scope.row.id].addRole"></el-checkbox>
									</template>
								</el-table-column>
								<el-table-column label="删除行" prop="type" width="60">
									<template #default="scope">
										<el-checkbox v-model="childTableRowRole[scope.row.id].delRole"></el-checkbox>
									</template>
								</el-table-column>
								<el-table-column label="操作">
									<template #default="scope">
										<el-button type="text" @click="setChildrenRole(scope.row)">设置</el-button>
									</template>
								</el-table-column>
							</scTable>
						</el-collapse-item>
					</el-collapse>
				</el-tab-pane>
				<el-tab-pane label="事件触发">
					<el-divider>前置插件</el-divider>
					<el-form-item label="接口名称">
						<el-select v-model="node.beforeClass" clearable style="width: 100%;"></el-select>
					</el-form-item>
					<el-form-item label="接口参数">
						<el-input v-model="node.beforeParam" placeholder="接口参数">
							<el-option v-for="item in pluginList" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-input>
					</el-form-item>
					<el-divider>后置插件</el-divider>
					<el-form-item label="后置插件">
						<el-select v-model="node.afterClass" clearable style="width: 100%;">
							<el-option v-for="item in pluginList" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="插件参数">
						<el-input v-model="node.afterParam" placeholder="接口参数"></el-input>
					</el-form-item>
					<el-divider>消息提醒</el-divider>
					<el-form-item label="抄送方式">
						<el-radio-group v-model="node.autoSendType">
							<el-radio-button label="0">禁止</el-radio-button>
							<el-radio-button label="1">自动</el-radio-button>
							<el-radio-button label="2">手动</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="抄送人员" v-if="node.autoSendType=='1'">
						<select-user-dialog v-model:accountId="node.autoSendUser" :mode="true"/>
					</el-form-item>
					<el-form-item label="审批人">
						<el-radio-group v-model="node.remindNextUser">
							<el-radio-button label="1">开启</el-radio-button>
							<el-radio-button label="0">禁用</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="发起人">
						<el-radio-group v-model="node.remindCreateUser">
							<el-radio-button label="1">开启</el-radio-button>
							<el-radio-button label="0">禁用</el-radio-button>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="参与人">
						<el-radio-group v-model="node.remindParticipant">
							<el-radio-button label="1">开启</el-radio-button>
							<el-radio-button label="0">禁用</el-radio-button>
						</el-radio-group>
					</el-form-item>
				</el-tab-pane>
			</el-form>
		</el-tabs>
		<el-footer>
			<el-button style="width: 100%" type="primary" icon="el-icon-check" @click="save">保存</el-button>
		</el-footer>
	</div>
	<div class="ef-node-form" v-show="(type === 'line')&& isNotChildFlowStep">
		<div class="ef-node-form-header">
			条件设置
		</div>
		<div class="ef-node-form-body">
			<el-form :model="line" :rules="rules" ref="dataFormLine" label-width="80px">
				<el-form-item label="条件标题" prop="label">
					<el-input v-model="line.label" placeholder="条件标题" maxlength="10"></el-input>
				</el-form-item>
				<el-divider>
					<el-link type="primary" @click="addCondition">添加子项</el-link>
				</el-divider>
				<div v-for="(item,index) in line.conditionItem" :key="item.key" style="margin: 5px 20px 5px 20px">
					# <span style="color: red">{{ `{` + (index + 1) + `}` }}</span>
					<span style="margin-left:10px;">'{{ item.title }}'</span>
					<span style="color:orange;margin-left:10px;">{{ item.per }} </span>
					<span style="color:#67c23a;margin-left:10px;margin-right: 10px">'{{ item.value }}'</span>
					<el-button type="text" @click="deleteCondition(index)">删除</el-button>
				</div>
				<el-form-item label="表达式">
					<el-input type="textarea" v-model="line.condition" placeholder="{1} and {2}"></el-input>
				</el-form-item>
				<el-footer>
					<el-button style="width: 100%" type="primary" icon="el-icon-check" @click="saveLine">保存</el-button>
				</el-footer>
			</el-form>
		</div>
	</div>
	<condition v-if="conditionDialog.save" ref="conditionDialog" @success="setChildCondition" @closed="conditionDialog.save=false"></condition>
	<children-role-setting v-if="childrenRoleSettingDialog.save" ref="childrenRoleSettingDialog" @success="setChildrenRoleSetting"
						   @closed="childrenRoleSettingDialog.save=false"></children-role-setting>
</template>

<script>
import {cloneDeep} from 'lodash'
import Condition from "@/views/doc/setting/bpmflow/condition";
import selectUserDialog from "@/views/module/selectUserDialog";
import selectDeptDialog from "@/views/module/selectDeptDialog";
import selectUserLevelDialog from "@/views/module/selectUserLevelDialog";
import ChildrenRoleSetting from "@/views/doc/setting/bpmflow/childrenRoleSetting";

export default {
	components: {
		ChildrenRoleSetting,
		Condition,
		selectUserLevelDialog,
		selectUserDialog,
		selectDeptDialog,
	},
	props: {},
	data() {
		return {
			isSaveing: false,
			conditionDialog: {
				save: false,
			},
			childrenRoleSettingDialog: {
				save: false
			},
			tempOrgId:'',
			isNotChildFlowStep:true,
			activeName: '1',
			formFieldList: [],
			childTableList: [],
			childTableRowRole: {},
			childTableRole: {},
			bpmStepList: [],
			waitStepList:[],
			userLevelList:[],
			autoUserModelOptions: [
				{value: "1", label: '默认人员'},
				{value: "2", label: '本部门领导'},
				{value: "3", label: '上级部门领导'},
				{value: "4", label: '指定部门领导'},
				{value: "6", label: '指定步骤部门领导'},
				{value: "7", label: '表单字段'},
				{value: "8", label: '公文发起人'},
				{value: "9", label: '公文发起人部门领导'},
				{value: "10", label: '上级分管领导'},
				{value: "11", label: '指定部门分管领导'},
				{value: "12", label: '指定步骤分管领导'},
				{value: "13", label: '公文发起人分管领导'},
				{value: "14", label: '指定步骤主办人'},
			],
			visible: true,
			// node 或 line
			type: 'node',
			node: {},
			line: {},
			data: {},
			pluginList:[],
			flowId: this.$route.query.flowId,
			stateList: '1',
			rules: {
				label: [
					{required: true, message: '条件标题不能为空', trigger: 'blur'}
				],
			}
		}
	},
	created() {
	},
	mounted() {
		this.getBpmPluginsListForSelect();
		this.loadBpmFlowStep();
	},
	watch: {
		'node.writerField': {
			handler(val) {
				if (typeof val == "string") {
					this.node.writerField = val.split(",");
				} else {
					this.node.writerField = val;
				}
			}
		},
		'node.hideField': {
			handler(val) {
				if (typeof val == "string") {
					this.node.hideField = val.split(",");
				} else {
					this.node.hideField = val;
				}
			}
		},
		'node.remark': {
			handler(val) {
				var than_ = this;
				this.data.nodeList.forEach(item => {
					if (than_.node.id == item.id) {
						item.remark = val;
					}
				})
			}
		},
		'node.state': {
			handler(val) {
				var than_ = this;
				this.data.nodeList.forEach(item => {
					if (than_.node.id == item.id) {
						item.state = val;
					}
				})
			}
		},
		'node.name': {
			handler(val) {
				var than_ = this;
				this.data.nodeList.forEach(item => {
					if (than_.node.id == item.id) {
						item.name = val;
					}
				})
			}
		},
	},
	methods: {
		/**
		 * 表单修改，这里可以根据传入的ID进行业务信息获取
		 * @param data
		 * @param id
		 */
		nodeInit(data, id, formFields) {
			this.tempOrgId=data.tempOrgId;
			this.type = 'node'
			this.data = data
			this.formFieldList = formFields,
				data.nodeList.filter((node) => {
					if (node.id === id) {
						this.childTableList = [];
						this.formFieldList.forEach(item => {
							if (item.elType == "children-data-table") {
								this.childTableList.push(item);
							}
						})
						this.node = cloneDeep(node)
						if (this.node.childTableRowRole != null && this.node.childTableRowRole != undefined && this.node.childTableRowRole != '') {
							this.childTableRowRole = JSON.parse(this.node.childTableRowRole);
							this.formFieldList.forEach(item => {
								if (item.elType == "children-data-table") {
									if (this.childTableRowRole[item.id] == undefined || this.childTableRowRole[item.id] == "" || this.childTableRowRole[item.id] == null) {
										this.childTableRowRole[item.id] = {"addRole": false, "delRole": false}
									}
								}
							})
						} else {
							this.formFieldList.forEach(item => {
								if (item.elType == "children-data-table") {
									this.childTableRowRole[item.id] = {"addRole": false, "delRole": false}
								}
							})
						}
						this.initModel(node.autoUserModel);
						this.getUserLevel();
					}
				})
		},
		lineInit(line,data) {
			this.isNotChildFlowStep = true;
			this.data = data;
			this.data.nodeList.forEach(item=>{
				if(item.id==line.from)
				{
					if(item.type=="childFlow")
					{
						this.isNotChildFlowStep = false;
					}
				}
			})
			this.type = 'line'
			this.line = line
		},
		// 修改连线
		saveLine() {
			this.$refs.dataFormLine.validate(async (valid) => {
				if (valid) {
					var res = await this.$API.bpm.bpmStepCondition.setBpmStepCondition.post({
						flowId:this.flowId,
						fromId: this.line.from,
						toId: this.line.to,
						label: this.line.label,
						stepCondition: this.line.condition,
						conditionItem: JSON.stringify(this.line.conditionItem)
					});
					this.isSaveing = false;
					if (res.code == 200) {
						this.$emit('setLineLabel', this.line.from, this.line.to, this.line.label, this.line.condition, this.line.conditionItem)
						this.visible = false;
						this.$message.success("操作成功")
					} else {
						this.$alert(res.message, "提示", {type: 'error'})
					}
				}
			})

		},
		save() {
			if (this.node.id == undefined) {
				this.$alert("请选择一个具体的修改节点", "提示", {type: 'error'})
				return;
			}
			this.data.nodeList.filter((node) => {
				if (node.id === this.node.id) {
					node.sortNo = this.sortNo
					node.flowId = this.flowId
					node.name = this.node.name
					node.left = this.node.left
					node.top = this.node.top
					node.ico = this.node.ico
					node.state = this.node.state
					node.remark = this.node.remark
					node.changeTitle = this.node.changeTitle
					node.follow = this.node.follow
					node.addStep = this.node.addStep
					node.approvalFlag = this.node.approvalFlag
					node.userRole = this.node.userRole
					node.deptRole = this.node.deptRole
					node.levelRole = this.node.levelRole
					node.approval = this.node.approval
					node.passEndFlag = this.node.passEndFlag
					node.parentWait = this.node.parentWait
					node.waitStepId = this.node.waitStepId
					node.goBack = this.node.goBack
					node.sameJump = this.node.sameJump
					node.concurrentFlag = this.node.concurrentFlag
					node.gatherFlag = this.node.gatherFlag
					node.sendToRole = this.node.sendToRole
					node.passTime = this.node.passTime
					node.userLevel = this.node.userLevel
					node.writerField = this.node.writerField
					node.childTableRole = this.node.childTableRole
					node.hideField = this.node.hideField
					node.xUploadRole = this.node.xUploadRole
					node.publicFileRole = this.node.publicFileRole
					node.bpmLinkFlag = this.node.bpmLinkFlag
					node.changeUser = this.node.changeUser
					node.doRule = this.node.doRule
					node.opRule = this.node.opRule
					node.autoUserModel = this.node.autoUserModel
					node.defaultAuto = this.node.defaultAuto
					node.defaultAutoOther = this.node.defaultAutoOther
					node.beforeClass = this.node.beforeClass
					node.beforeParam = this.node.beforeParam
					node.afterClass = this.node.afterClass
					node.afterParam = this.node.afterParam
					node.autoSendType = this.node.autoSendType
					node.remindNextUser = this.node.remindNextUser
					node.remindCreateUser = this.node.remindCreateUser
					node.remindParticipant = this.node.remindParticipant
					this.saveBpmStepInfo();
				}
			})
		},
		setChildrenRole(item) {
			this.childrenRoleSettingDialog.save = true;
			this.$nextTick(() => {
				this.$refs.childrenRoleSettingDialog.open().setData(item, this.node.childTableRole);
			})

		},
		deleteCondition(index) {
			this.line.conditionItem.splice(index, 1);
		},
		addCondition() {
			this.conditionDialog.save = true
			this.$nextTick(() => {
				this.$refs.conditionDialog.open().setConditionFields(this.flowId);
			})
		},
		setChildCondition(data) {
			this.line.conditionItem.push({
				title: data.title,
				field: data.field,
				per: data.optionPer,
				value: data.value
			})
		},
		setChildrenRoleSetting(data) {
			var json = {};
			if (this.node.childTableRole != "" && this.node.childTableRole != null && this.node.childTableRole != undefined) {
				json = JSON.parse(this.node.childTableRole);
			}
			json = Object.assign(json, data);
			this.node.childTableRole = JSON.stringify(json);
		},
		async getBpmPluginsListForSelect(){
			var res = await this.$API.bpm.plugins.getBpmPluginsListForSelect.get({flowId:this.flowId});
			if (res.code == 200) {
				this.pluginList = res.data;
			}
		},
		async saveBpmStepInfo() {
			var params = this.node;
			params.childTableRowRole = JSON.stringify(this.childTableRowRole);
			params = JSON.parse(JSON.stringify(params));
			if (params.hideField != undefined) {
				params.hideField = this.node.hideField.join(",");
			}
			if (params.writerField != undefined) {
				params.writerField = this.node.writerField.join(",");
			}
			var res = await this.$API.bpm.bpmStep.update.post(params);
			if (res.code == 200) {
				this.$message.success("操作成功");
				this.$emit('repaintEverything');
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async loadBpmFlowStep() {
			var res = await this.$API.bpm.bpmStep.getBpmFlowStepByFlowIdForSelect.get({flowId: this.flowId});
			if (res.code == 200) {
				this.waitStepList = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		initModel(val) {
			if (val == '6' || val == '12' || val == '14') {
				this.bpmStepList = this.waitStepList;
			} else {
				this.bpmStepList = [];
			}
		},
		async getUserLevel(){
			let res;
			if(this.tempOrgId=='0'){
				res = await this.$API.system.userLevel.getUserLevelForSelect.get();
			}else {
				res = await this.$API.system.tempOrg.getTempUserLevelForSelect.get({tempOrgId:this.tempOrgId});
			}
			if(res.code==200)
			{
				this.userLevelList = res.data;
			}
		},
	}
}
</script>
<style lang="scss" scoped>
> > > .el-descriptions__body {
	text-align: center;
}

.el-radio-button {
	:deep(.el-radio-button__inner) {
		padding: 5px 6px;
	}
}

.el-node-form-tag {
	position: absolute;
	top: 50%;
	margin-left: -15px;
	height: 40px;
	width: 15px;
	background-color: #fbfbfb;
	border: 1px solid rgb(220, 227, 232);
	border-right: none;
	z-index: 0;
}
</style>
